package 异常处理;

public class Two {
    public static void main(String[] args) {
        try{
            divide();
        }catch(Exception e){
            System.out.println("发生了运行时异常：" + e.getMessage());
        }
    }
    //单独提取一个两个数相处的方法
    public static void divide() throws Exception {
        int num1=10;
        int num2=0;
        if(num2==0){
                throw new Exception();
        }
        else{
            System.out.println("两个数的商是"+num1/num2);
        }

    }
}
